#include "LineBear.h"

#include <QVariant>

#include "Point.h"

QString COLUMN_NAME_SIZE= "size";
QString COLUMN_NAME_POINT = "point";

QString COLUMN_TYPE_SIZE = "int";
QString COLUMN_TYPE_POINT = "Point";

LineBear::LineBear()
{
	m_object = new BBObject;
	m_object->setName( "Line" );
	m_object->setAttributeType( COLUMN_NAME_SIZE, COLUMN_TYPE_SIZE );
	m_object->setAttributeType( COLUMN_NAME_POINT, COLUMN_TYPE_POINT );
	m_object->setAttributePrimitiveValue( COLUMN_NAME_SIZE, NULL );
	m_object->setAttributeCompositionValue( COLUMN_NAME_POINT, NULL );
	addObject( m_object );
}

int LineBear::getSize()
{
	return m_object->getAttributePrimitiveValue( COLUMN_NAME_SIZE ).toInt();
}

void LineBear::setSize( int value )
{
	m_object->setAttributePrimitiveValue( COLUMN_NAME_SIZE, value );
}

Point LineBear::getPoint()
{
	//Bear bear = m_object->getAttributeCompositionValue( COLUMN_NAME_POINT ).value<Bear>();
	
	//Point point = m_object->getAttributeCompositionValue( COLUMN_NAME_POINT ).value<Point>();
	return Point();
}

void LineBear::setPoint( Point point )
{
	Bear bear = point;
	QVariant var;
	var.setValue( bear );
	m_object->setAttributeCompositionValue( COLUMN_NAME_POINT, var );
}
